package stream;

import java.io.CharArrayReader;
import java.io.CharArrayWriter;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.StringBufferInputStream;

public class Test1 {
	
	public static void main(String[] args) throws Exception {
		CharArrayWriter cw = new CharArrayWriter();
		for(char c='a';c<='g'; c++){
			cw.write(c);
		}
		cw.flush();
		char[] arr = cw.toCharArray();
		cw.close();
		
		CharArrayReader cr = new CharArrayReader(arr);
		int n=-1;
		while(-1!=(n=cr.read())){
			System.out.print((char)n+" ");
		}
	}

}
